﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using V = Science.Mathematics.VectorCalculus;

namespace VectorCalculus5Ed.Chapter5.Section5
{
    public class Example05
    {
        public Example05()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
        public void Compute()
        {
            V.Function.ToLastType<double[], double> f
                = new V.Function.ToLastType<double[], double>(func);
            double[] from = { 0.0, 0.0, 0.0 };
            double[] to = { Math.Sqrt(2.0), Math.Sqrt(2.0), 2.0 };
            V.IntegrationMultiD obj = new V.IntegrationMultiD(f, from, to);
            obj.Compute();
            result += obj.BestEstimation.ToString() + "\r\n";
            obj.NumberOfCall = 10000000;
            obj.Compute();
            result += obj.BestEstimation.ToString() + "\r\n";
            double a = 8.0 * Math.Sqrt(2.0) / 15.0;
            result += a.ToString() + "\r\n";
        }
        private double func(double[] x)
        {
            if (x[2] - x[0] * x[0] - x[1] * x[1] >= 0.0) return x[0];
            return 0.0;
        }
    }
}
/* 
0.754871959725782
0.754262838905697
0.754247233265651
*/

